package com.csun.cmny.provider.model.enums.device;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-03-06 13:54
 * @Description: the enum dmc device alert type
 */
public enum DmcDeviceAlertTypeEnum {

    PHONE_BTN_ALERT(0, "紧急警报"),

    RANGE_ALERT(1, "范围警报"),

    CSUN_BUTTON(2, "紧急按钮"),

    CSUN_BODY_SENSOR(3, "人体感应"),

    RFID_ALERT(4, "门禁警报"),

    WX_WATCH(5, "孝心手环"),

    CSUN_SLEEP_BED_DOWN(6, "从床上跌倒"),

    CSUN_SLEEP_BREATH_STOP(7, "呼吸停止"),

    CSUN_SLEEP_ACTION(8, "翻身报警"),

    ALARM_LIGHT(9, "报警灯"),

    CSUN_SLEEP_OFF_LINE(10, "离线报警"),

    CSUN_SLEEP_OFF_BED(11, "离床报警"),

    CSUN_HUMIDISTAT_ERROR(12, "温度异常报警"),

    CSUN_CAMERA_FILL(13, "摄像头跌倒报警"),

    CSUN_LIFE_BODY_SENSOR_ALERT_LEVEL_ONE(14,"入厕提示 已达到注意时间"),

    CSUN_LIFE_BODY_SENSOR_ALERT_LEVEL_TWO(15,"入厕提示 已达到警告时间"),

    CSUN_LIFE_BODY_SENSOR_ALERT_LEVEL_THREE(16,"入厕提示 已达到异常时间"),

    CSUN_SLEEP_BREATH_ALERT(17, "呼吸异常报警"),

    CSUN_SLEEP_HEARTBEAT_ALERT(18, "心跳异常报警"),

    CSUN_FOLLOW_TEMPERATURE(19,"老人体温异常报警"),

    CSUN_LEAVE_ROOM_ALERT(20, "夜间巡视异常"),

    CSUN_CAMERA_OFF_LINE(21, "摄像头离线报警"),

    CSUN_BODYSENSOR_OFF_LINE(22, "人感离线报警"),

    CSUN_GATEWAY_OFF_LINE(23, "网关离线报警"),

    CSUN_HUMIDISTAT_OFF_LINE(24, "温度计离线报警"),

    CSUN_DOOR(25, "门磁报警"),

    CSUN_BODY_GROUP(26, "老人不在房间报警"),

    /**
     * 魔盒报警设备
     */
    INFRARED_DETECTOR(27,"红外探测器报警"),
    EMERGENCY_CALLER(28,"紧急呼叫器报警"),
    SMOKE_ALARM(29,"烟雾报警"),
    GAS_ALARM(30,"煤气报警"),
    OVERFLOW_ALARM(31,"溢水报警"),
    DOOR_SENSOR(32,"门磁感应器报警"),


    ;
    Integer key;

    String value;

    DmcDeviceAlertTypeEnum(Integer key, String value) {
        this.key = key;
        this.value = value;
    }

    /**
     * Gets key.
     *
     * @return the key
     */
    public Integer getKey() {
        return key;
    }

    /**
     * Gets value.
     *
     * @return the value
     */
    public String getValue() {
        return value;
    }

    /**
     * 获取key获取value
     *
     * @param key key
     *
     * @return value value
     */
    public static String getValue(Integer key) {
        for (DmcDeviceAlertTypeEnum ele : DmcDeviceAlertTypeEnum.values()) {
            if (key.equals(ele.getKey())) {
                return ele.getValue();
            }
        }
        return null;
    }

    /**
     * 根据key获取该对象
     *
     * @param key key
     *
     * @return this enum
     */
    public static DmcDeviceAlertTypeEnum getEnum(String key) {
        for (DmcDeviceAlertTypeEnum ele : DmcDeviceAlertTypeEnum.values()) {
            if (key.equals(ele.getKey())) {
                return ele;
            }
        }
        return null;
    }

    /**
     * 获取List集合
     *
     * @return List list
     */
    public static List<DmcDeviceAlertTypeEnum> getList() {
        return Arrays.asList(DmcDeviceAlertTypeEnum.values());
    }


    /**
     * 获取map类型集合
     *
     * @return Map类型List集合 map 2 list
     */
//    public static List<Map<String, String>> getMap2List() {
//        List<Map<String, String>> list = Lists.newArrayList();
//        for (DmcDeviceAlertTypeEnum ele : DmcDeviceAlertTypeEnum.values()) {
//            Map<Integer, String> map = Maps.newHashMap();
//            map.put("key", ele.getKey());
//            map.put("value", ele.getValue());
//            list.add(map);
//        }
//        return list;
//    }
}
